<?php
// +----------------------------------------------------------------------
// | title: 标题注释
// +----------------------------------------------------------------------
// | Author: TZ.Leong
// +----------------------------------------------------------------------
// | Date: 2019/11/20 16:33
// +----------------------------------------------------------------------

namespace app\single\api;


use app\single\model\PlayerOnlineModel;

class PlayerOnline
{
    public function run($params)
    {
        $data["ret"] = 1;
        $sDate = date("Ymd", strtotime($params["sDate"]));
        $eDate = date("Ymd", strtotime($params["eDate"]));
        $model = new PlayerOnlineModel();
        $onlineData = $model->whereBetween("day",[$sDate,$eDate])->field("id, world2game",true)->select()->toArray();
        foreach($onlineData as &$vo){
            $vo["month"] = date("Ym", strtotime($vo["day"]));
        }
        $data["data"] = $onlineData;
        return $data;
    }
}